package com.tony.firewall.views;

import android.content.Context;
import android.util.AttributeSet;
import android.widget.Checkable;
import android.widget.LinearLayout;

import com.tony.firewall.R;

public class CheckableLinearLayout extends LinearLayout implements Checkable {
	private boolean mChecked;

	public CheckableLinearLayout(Context context) {
		super(context);
	}

	public CheckableLinearLayout(Context context, AttributeSet attrs) {
		super(context, attrs);
	}

	public CheckableLinearLayout(Context context, AttributeSet attrs, int defStyle) {
		super(context, attrs, defStyle);
	}

	@Override
	public void setChecked(boolean checked) {
		mChecked = checked;
		setBackgroundResource(checked ? R.drawable.selector_message_list_checked_bg : R.drawable.selector_message_list_bg);
//		setBackgroundDrawable(checked ? new ColorDrawable(0xffA0DCF0) : null);
	}

	@Override
	public boolean isChecked() {
		return mChecked;
	}

	@Override
	public void toggle() {
		setChecked(!mChecked);
	}

}
